import React from 'react';

import { Select } from 'antd';

type Props = {
  value?: any[];
  onChange?: (value: any[]) => void;
};

const SingerTxtSelect: React.FC<Props> = ({ value, onChange }) => {
  return (
    <Select
      value={
        value
          ? value.map((item) => {
              return item.singerName;
            })
          : []
      }
      onChange={(e) => {
        if (onChange) {
          onChange(
            e.map((name) => {
              return {
                singerId: 0,
                singerName: name,
              };
            }),
          );
        }
      }}
      mode="tags"
    ></Select>
  );
};

export default SingerTxtSelect;
